import java.util.HashMap;
import java.util.Map;

public class day06 {

    public static void main(String[] args) {


        Character [] arr={'a','a','b','a','n','a','a','b'};

        Map<Character,Integer> map=new HashMap<>();

        for (int i = 0; i <arr.length ; i++) {

            Integer count = map.get(arr[i]);

            if (count==null){
                count=1;
            }else {
                count++;
            }
            map.put(arr[i],count);
        }
    }
}
